<?php

namespace app\api\validate;

use think\Validate;

class Article extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'id'=>'require',
        'title'=>'require|length:1,100',
        'first'=>'require',
        //'coverimages'=>'regex:^[\d,]+$',
        'postcontent'=>'require',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'id.require'    => '文章id不可为空',
        'title.require' => '文章标题不可为空',
        'title.length'  => '文章标题长度不可超过100字',
        'first'         => '分类id不可为空',
        //'coverimages'   => '图集格式不正确',
        'postcontent'   => '正文不可为空'
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['title','first','coverimages','postcontent'],
        'edit' => ['id','title','first','coverimages','postcontent'],
    ];
    
}
